﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Blake.NUI.WPF.Utility;
using System.Windows.Media.Animation;

namespace Kinductor.Views
{
    /// <summary>
    /// Interaction logic for VolumeSlider.xaml
    /// </summary>
    public partial class VolumeSlider : UserControl
    {
        CircleEase ease = new CircleEase();
        public VolumeSlider()
        {
            InitializeComponent();
        }

        public void SetVolume(double volumeNormalized)
        {
            slider.Margin = new Thickness(0, 0, 0, volumeNormalized * 134);
        }

        public void Hide(bool useTransitions = true)
        {
            if (useTransitions)
            {
                AnimateUtility.AnimateElementDouble(layoutRoot, FrameworkElement.OpacityProperty, 0, 0, 1, ease);
            }
            else
            {
                layoutRoot.Opacity = 0;
            }
        }

        public void Show(bool useTransitions = true)
        {
            if (useTransitions)
            {
                AnimateUtility.AnimateElementDouble(layoutRoot, FrameworkElement.OpacityProperty, 1, 0, 1, ease);
            }
            else
            {
                layoutRoot.Opacity = 1;
            }
        }
    }
}
